package com.deep.deepenterprise.api.controller.unit;

import com.deep.deepenterpise.common.result.DrResult;
import com.deep.deepenterpise.model.to.unit.DrCheckFirstTo;
import com.deep.deepenterpise.model.to.unit.DrCheckHousePutTo;
import com.deep.deepenterpise.model.to.unit.DrCheckItemPageTo;
import com.deep.deepenterpise.model.to.unit.DrCheckPageTo;
import com.deep.deepenterpise.service.unit.IDrCheckService;
import com.deep.deepenterprise.api.threadlocal.DrLoginTokenContext;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author xyz
 * @version 1.0
 * @title DrCheckController
 * @description
 * @create 2024/5/14 03:05
 */
@RestController
@RequestMapping("/v12/interface/dr")
@Validated
public class DrCheckController {
    @Resource
    private IDrCheckService iDrCheckService;

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 获取入户检查项目列表
     * @Time 13:43 2024/6/13
     */
    @GetMapping("/dr-check-house-item")
    public DrResult getDrCheckHouseItem() {
        String drUserUuid = DrLoginTokenContext.getUserId();
        return iDrCheckService.getDrCheckHouseItem(drUserUuid);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 获取隐患子状态
     * @Time 21:11 2024/6/24
     */
    @GetMapping("/dr-danger-slave-status")
    public DrResult getDrDangerSlaveStatus() {
        return iDrCheckService.getDrDangerSlaveStatus();
    }


    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 提交入户检查项目
     * @Time 21:45 2024/6/13
     * @Param [drCheckHousePutTo]
     */
    @PostMapping("/dr-check-house-put")
    public DrResult postDrCheckHousePut(@Valid @RequestBody DrCheckHousePutTo drCheckHousePutTo) {
        String drUserUuid = DrLoginTokenContext.getUserId();
        return iDrCheckService.postDrCheckHousePut(drUserUuid, drCheckHousePutTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO
     * @Time 15:41 2024/6/22
     * @Param [drCheckFirstTo]
     */
    @PostMapping("/dr-check-house-first")
    public DrResult postDrCheckHouseFirst(@Valid @RequestBody DrCheckFirstTo drCheckFirstTo) {
        return iDrCheckService.postDrCheckHouseFirst(drCheckFirstTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 获取安检项
     * @Time 11:16 2024/6/24
     * @Param [drCheckItemPageTo]
     */
    @PostMapping("/dr-check-item-list")
    public DrResult postDrCheckItemList(@Valid @RequestBody DrCheckItemPageTo drCheckItemPageTo) {
        return iDrCheckService.postDrCheckItemList(drCheckItemPageTo);
    }

    /**
     * @return com.deep.deepenterpise.common.result.DrResult
     * @Auth xyz
     * @Desc //TODO 获取安检列表
     * @Time 16:21 2024/6/24
     * @Param [drCheckPageTo]
     */
    @PostMapping("/dr-check-list")
    public DrResult postDrCheckList(@Valid @RequestBody DrCheckPageTo drCheckPageTo) {
        return iDrCheckService.postDrCheckList(drCheckPageTo);
    }
}
